package com.mt.mall.entity.good;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import com.mt.mall.entity.merchant.Shop;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.common.system.entity.Attachment;
import com.mt.mall.entity.good.Commodity;

@DEntity(label="商品规格",comment="",moduleLabel="商品规格")
@Entity(name="mall_specification")
@Table(name = "mall_specification" , indexes = { @Index(name = "index_commodity_id", columnList = "commodity_id"),@Index(name = "index_parent_id", columnList = "parent_id"),@Index(name = "index_description_img_id", columnList = "description_img_id")  })
@ApiModel(description = "商品规格:")
public class Specification extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="商品",component="对象选择",where=true)
	@ApiModelProperty(value = "商品:商品")
	@Column(name="commodity_id",length=255,nullable=true,unique=false)
	private Long commodityId;

	@Transient
	private Commodity commodity;

	@Transient
	@ApiModelProperty(value = "商品名称:商品")
	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="商品")
	private String commodityName;


	@Transient
	@ApiModelProperty(value = "商品描述:商品")
	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="商品")
	private String commodityDescription;

	@DColumn(index=4,label="父级",foreignEntity="Specification",comment="父级规格",component="对象选择",where=false)
	@ApiModelProperty(value = "父级:父级规格")
	@Column(name="parent_id",length=255,nullable=true,unique=false)
	private Long parentId;

	@Transient
	private Specification parent;

	@Transient
	@ApiModelProperty(value = "父级名称:父级规格")
	@DColumn(index=4,label="父级",foreignEntity="Specification",comment="父级规格")
	private String parentName;

	@DColumn(index=5,label="描述",comment="规格描述",component="文本",where=false)
	@ApiModelProperty(value = "描述:规格描述")
	@Column(name="description",length=10,nullable=true,unique=false)
	private String description;

	@DColumn(index=6,label="图片",foreignEntity="Attachment",comment="图片",component="对象选择",where=false)
	@ApiModelProperty(value = "图片:图片")
	@Column(name="description_img_id",length=255,nullable=true,unique=false)
	private Long descriptionImgId;



	@Transient
	private Attachment descriptionImg;

	@Transient
	@ApiModelProperty(value = "图片名称:图片")
	@DColumn(index=6,label="图片",foreignEntity="Attachment",comment="图片")
	private String descriptionImgName;


	@DColumn(index=5,label="排序号",comment="排序号",component="整数",where=false)
	@ApiModelProperty(value = "排序号:排序号")
	@Column(name="sort_num",length=255,nullable=true,unique=false)
	private Integer sortNum;

	@DColumn(index=6,label="店铺",foreignEntity="Shop",comment="店铺信息",component="对象选择",where=true)
	@ApiModelProperty(value = "店铺:店铺信息")
	@Column(name="shop_id",length=255,nullable=false,unique=false)
	private Long shopId;

	@Transient
	private Shop shop;

	@Transient
	@ApiModelProperty(value = "店铺名称:店铺信息")
	@DColumn(index=6,label="店铺",foreignEntity="Shop",comment="店铺信息")
	private String shopName;

	public Long getShopId() {
		return shopId;
	}

	public void setShopId(Long shopId) {
		this.shopId = shopId;
	}

	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	@Transient
	private List<Specification> children;

	public List<Specification> getChildren() {
		return children;
	}

	public void setChildren(List<Specification> children) {
		this.children = children;
	}

	public Integer getSortNum() {
		return sortNum;
	}

	public void setSortNum(Integer sortNum) {
		this.sortNum = sortNum;
	}

	public String getCommodityDescription() {
		return commodityDescription;
	}

	public void setCommodityDescription(String commodityDescription) {
		this.commodityDescription = commodityDescription;
	}

	public Long getCommodityId() {
		return this.commodityId;
	}

	public void setCommodityId(Long commodityId) {
		this.commodityId = commodityId;
	}

	public Long getParentId() {
		return this.parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Long getDescriptionImgId() {
		return this.descriptionImgId;
	}

	public void setDescriptionImgId(Long descriptionImgId) {
		this.descriptionImgId = descriptionImgId;
	}

	public Commodity getCommodity() {
		return this.commodity;
	}

	public void setCommodity(Commodity commodity) {
		if(commodity == null){
		}
		else
		{
		this.commodityId = commodity.getEid();
		this.commodity = commodity;		
		}
}

	public String getCommodityName() {
		return this.commodityName;
	}

	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}

	public Specification getParent() {
		return this.parent;
	}

	public void setParent(Specification parent) {
		if(parent == null){
		}
		else
		{
		this.parentId = parent.getEid();
		this.parent = parent;		
		}
}

	public String getParentName() {
		return this.parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public Attachment getDescriptionImg() {
		return this.descriptionImg;
	}

	public void setDescriptionImg(Attachment descriptionImg) {
		if(descriptionImg == null){
		}
		else
		{
		this.descriptionImgId = descriptionImg.getEid();
		this.descriptionImg = descriptionImg;		
		}
}

	public String getDescriptionImgName() {
		return this.descriptionImgName;
	}

	public void setDescriptionImgName(String descriptionImgName) {
		this.descriptionImgName = descriptionImgName;
	}



}
